package com.chen.solution.validator.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class ValidatorExceptionDemoApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ValidatorExceptionDemoApplication.class, args);

        Environment env = applicationContext.getEnvironment();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path") ;

        if(path == null){
            path = "";
        }
        System.out.println("\n----------------------------------------------------------\n\t" +
                "Server is running! Access URLs:\n\t" +
                "Local: \t\t\thttp://localhost:" + port + "/\n\t" +
                "Context-path: \thttp://localhost:" + port + "/"+path+"\n\t" +
                "Swagger: \t\thttp://localhost:" + port + "/"+path+"/doc.html"+"\n" +
                "----------------------------------------------------------");
    }

}
